/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.openbravo.bean.shard;

import cn.ekuma.security.bean.I_Permission;

/**
 *
 * @author Administrator
 */
public class UserPermission implements java.io.Serializable,I_Permission{
     /**
	 * 
	 */
	private static final long serialVersionUID = 5185321050886882384L;
	public static String PERMISSIONGROUP_Default="default";
     public static String PERMISSIONGROUP_System="system";

     private String permission;
     private String group;
     private int id=9999;

    public UserPermission(int id,String permission) {
        this(id,permission,PERMISSIONGROUP_Default);
    }

    public UserPermission(int id,String permission, String group) {
        this.id=id;
        this.permission = permission;
        this.group = group;
    }

    public String getGroup() {
        return group;
    }

    public void setGroup(String group) {
        this.group = group;
    }

    public String getPermission() {
        return permission;
    }

    public void setPermission(String permission) {
        this.permission = permission;
    }

    @Override
    public boolean equals(Object obj) {
        if(obj==null)
            return false;
        if((obj!=null)&&(obj instanceof UserPermission)) {
            return ((UserPermission)obj).getPermission().equalsIgnoreCase(permission);
        }
        return false;
    }

    public static UserPermission createPermission(String permane){
        return new UserPermission(0,permane);
    }

	@Override
	public int getId() {
		return id;
	}

	@Override
	public String getBaseSecurityName() {
		return permission;
	}

	@Override
	public int getExtPermission() {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public String getMemo() {
		// TODO Auto-generated method stub
		return null;
	}
}
